package mua.core.operation.list;

import mua.core.value.List;
import mua.core.value.MuaValue;
import mua.core.value.Word;

import java.util.ArrayList;

public class ButFirst {
    public static MuaValue run(MuaValue a) {
        if(a instanceof List){
            ArrayList<MuaValue> list = new ArrayList<>((ArrayList<MuaValue>)a.getValue());
            if(list.size()>0)list.remove(0);
            return new List(list);
        }
        String str = a.toString();
        return new Word(str.substring(1));
    }
}
